import request from '@/config/axios'
import signMd5Utils from '@/utils/signMd5Utils'
// import type { responseType } from './types'

const signHeader = (url: string, params: any) => {
  const sign = signMd5Utils.getSign(url, params)
  return { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getDateTimeToString() }
}

// 获取时间
export const getSystemByToken = (params: any): Promise<LoginResponse> => {
  // const sign = signMd5Utils.getSign('/sys/permission/getUserPermissionByToken', params)
  // //将签名和时间戳，添加在请求接口 Header
  // const signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getDateTimeToString() }
  return request.get({
    url: '/sys/permission/getUserPermissionByToken',
    params,
    headers: signHeader('/sys/permission/getUserPermissionByToken', params)
  })
}

export const getTomcatCreated = (params: any) => {
  return request.get({ url: '/actuator/metrics/tomcat.sessions.created', params })
}

export const getTomcatExpired = (params: any): Promise<MonitorResponse> => {
  return request.get({ url: '/actuator/metrics/tomcat.sessions.expired', params })
}
export const getTomcatCurrent = (params: any): Promise<MonitorResponse> => {
  return request.get({ url: '/actuator/metrics/tomcat.sessions.active.current', params })
}
export const getTomcatActiveMax = (params: any): Promise<MonitorResponse> => {
  return request.get({ url: '/actuator/metrics/tomcat.sessions.active.max', params })
}
export const getTomcatRejected = (params: any): Promise<MonitorResponse> => {
  return request.get({ url: '/actuator/metrics/tomcat.sessions.rejected', params })
}
/*
export const getTomcatCreated = (params: any): Promise<MonitorResponse> => {
  return request.get({
    url: '/actuator/metrics/tomcat.sessions.created',
    params,
    headers: signHeader('/actuator/metrics/tomcat.sessions.created', params)
  })
}
export const getTomcatExpired = (params: any): Promise<MonitorResponse> => {
  return request.get({
    url: '/actuator/metrics/tomcat.sessions.expired',
    params,
    headers: signHeader('/actuator/metrics/tomcat.sessions.expired', params)
  })
}
export const getTomcatCurrent = (params: any): Promise<MonitorResponse> => {
  return request.get({
    url: '/actuator/metrics/tomcat.sessions.active.current',
    params,
    headers: signHeader('/actuator/metrics/tomcat.sessions.active.current', params)
  })
}
export const getTomcatActiveMax = (params: any): Promise<MonitorResponse> => {
  return request.get({
    url: '/actuator/metrics/tomcat.sessions.active.max',
    params,
    headers: signHeader('/actuator/metrics/tomcat.sessions.active.max', params)
  })
}
export const getTomcatRejected = (params: any): Promise<MonitorResponse> => {
  return request.get({
    url: '/actuator/metrics/tomcat.sessions.rejected',
    params,
    headers: signHeader('/actuator/metrics/tomcat.sessions.rejected', params)
  })
}
*/
